(function(n,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(t):n.Popper=t()})(this,function(){"use strict";function ri(n){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1;n()}))}}function ui(n){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1;n()},ft))}}function st(n){return n&&{}.toString.call(n)==="[object Function]"}function i(n,t){if(n.nodeType!==1)return[];var i=getComputedStyle(n,null);return t?i[t]:i}function w(n){return n.nodeName==="HTML"?n:n.parentNode||n.host}function e(n){if(!n)return document.body;switch(n.nodeName){case"HTML":case"BODY":return n.ownerDocument.body;case"#document":return n.body}var t=i(n),r=t.overflow,u=t.overflowX,f=t.overflowY;return/(auto|scroll)/.test(r+f+u)?n:e(w(n))}function r(n){var t=n&&n.offsetParent,u=t&&t.nodeName;return!u||u==="BODY"||u==="HTML"?n?n.ownerDocument.documentElement:document.documentElement:["TD","TABLE"].indexOf(t.nodeName)!==-1&&i(t,"position")==="static"?r(t):t}function fi(n){var t=n.nodeName;return t==="BODY"?!1:t==="HTML"||r(n.firstElementChild)===n}function b(n){return n.parentNode!==null?b(n.parentNode):n}function c(n,t){var i,f;if(!n||!n.nodeType||!t||!t.nodeType)return document.documentElement;var e=n.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,o=e?n:t,s=e?t:n,u=document.createRange();return(u.setStart(o,0),u.setEnd(s,0),i=u.commonAncestorContainer,n!==i&&t!==i||o.contains(s))?fi(i)?i:r(i):(f=b(n),f.host?c(f.host,t):c(n,b(t).host))}function u(n){var f=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"top",t=f==="top"?"scrollTop":"scrollLeft",i=n.nodeName,r,u;return i==="BODY"||i==="HTML"?(r=n.ownerDocument.documentElement,u=n.ownerDocument.scrollingElement||r,u[t]):n[t]}function ei(n,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1,r=u(t,"top"),f=u(t,"left"),i=e?-1:1;return n.top+=r*i,n.bottom+=r*i,n.left+=f*i,n.right+=f*i,n}function ht(n,t){var i=t==="x"?"Left":"Top",r=i==="Left"?"Right":"Bottom";return parseFloat(n["border"+i+"Width"],10)+parseFloat(n["border"+r+"Width"],10)}function ct(n,t,i,r){return Math.max(t["offset"+n],t["scroll"+n],i["client"+n],i["offset"+n],i["scroll"+n],o()?i["offset"+n]+r["margin"+(n==="Height"?"Top":"Left")]+r["margin"+(n==="Height"?"Bottom":"Right")]:0)}function lt(){var t=document.body,n=document.documentElement,i=o()&&getComputedStyle(n);return{height:ct("Height",t,n,i),width:ct("Width",t,n,i)}}function t(t){return n({},t,{right:t.left+t.width,bottom:t.top+t.height})}function k(n){var r={},e,s,l;if(o())try{r=n.getBoundingClientRect();e=u(n,"top");s=u(n,"left");r.top+=e;r.left+=s;r.bottom+=e;r.right+=s}catch(p){}else r=n.getBoundingClientRect();var f={left:r.left,top:r.top,width:r.right-r.left,height:r.bottom-r.top},a=n.nodeName==="HTML"?lt():{},v=a.width||n.clientWidth||f.right-f.left,y=a.height||n.clientHeight||f.bottom-f.top,h=n.offsetWidth-v,c=n.offsetHeight-y;return(h||c)&&(l=i(n),h-=ht(l,"x"),c-=ht(l,"y"),f.width-=h,f.height-=c),t(f)}function d(n,r){var y=o(),w=r.nodeName==="HTML",f=k(n),p=k(r),l=e(n),s=i(r),a=parseFloat(s.borderTopWidth,10),v=parseFloat(s.borderLeftWidth,10),u=t({top:f.top-p.top-a,left:f.left-p.left-v,width:f.width,height:f.height}),h,c;return u.marginTop=0,u.marginLeft=0,!y&&w&&(h=parseFloat(s.marginTop,10),c=parseFloat(s.marginLeft,10),u.top-=a-h,u.bottom-=a-h,u.left-=v-c,u.right-=v-c,u.marginTop=h,u.marginLeft=c),(y?r.contains(l):r===l&&l.nodeName!=="BODY")&&(u=ei(u,r)),u}function hi(n){var i=n.ownerDocument.documentElement,r=d(n,i),f=Math.max(i.clientWidth,window.innerWidth||0),e=Math.max(i.clientHeight,window.innerHeight||0),o=u(i),s=u(i,"left"),h={top:o-r.top+r.marginTop,left:s-r.left+r.marginLeft,width:f,height:e};return t(h)}function at(n){var t=n.nodeName;return t==="BODY"||t==="HTML"?!1:i(n,"position")==="fixed"?!0:at(w(n))}function g(n,t,i,r){var u={top:0,left:0},s=c(n,t),o,f;if(r==="viewport")u=hi(s);else if(o=void 0,r==="scrollParent"?(o=e(w(t)),o.nodeName==="BODY"&&(o=n.ownerDocument.documentElement)):o=r==="window"?n.ownerDocument.documentElement:r,f=d(o,s),o.nodeName!=="HTML"||at(s))u=f;else{var h=lt(),l=h.height,a=h.width;u.top+=f.top-f.marginTop;u.bottom=l+f.top;u.left+=f.left-f.marginLeft;u.right=a+f.left}return u.left+=i,u.top+=i,u.right-=i,u.bottom-=i,u}function ci(n){var t=n.width,i=n.height;return t*i}function vt(t,i,r,u,f){var l=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;if(t.indexOf("auto")===-1)return t;var e=g(r,u,l,f),o={top:{width:e.width,height:i.top-e.top},right:{width:e.right-i.right,height:e.height},bottom:{width:e.width,height:e.bottom-i.bottom},left:{width:i.left-e.left,height:e.height}},s=Object.keys(o).map(function(t){return n({key:t},o[t],{area:ci(o[t])})}).sort(function(n,t){return t.area-n.area}),h=s.filter(function(n){var t=n.width,i=n.height;return t>=r.clientWidth&&i>=r.clientHeight}),a=h.length>0?h[0].key:s[0].key,c=t.split("-")[1];return a+(c?"-"+c:"")}function yt(n,t,i){var r=c(t,i);return d(i,r)}function pt(n){var t=getComputedStyle(n),i=parseFloat(t.marginTop)+parseFloat(t.marginBottom),r=parseFloat(t.marginLeft)+parseFloat(t.marginRight);return{width:n.offsetWidth+r,height:n.offsetHeight+i}}function a(n){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return n.replace(/left|right|bottom|top/g,function(n){return t[n]})}function wt(n,t,i){i=i.split("-")[0];var r=pt(n),e={width:r.width,height:r.height},u=["right","left"].indexOf(i)!==-1,o=u?"top":"left",f=u?"left":"top",s=u?"height":"width",h=u?"width":"height";return e[o]=t[o]+t[s]/2-r[s]/2,e[f]=i===f?t[f]-r[h]:t[a(f)],e}function s(n,t){return Array.prototype.find?n.find(t):n.filter(t)[0]}function li(n,t,i){if(Array.prototype.findIndex)return n.findIndex(function(n){return n[t]===i});var r=s(n,function(n){return n[t]===i});return n.indexOf(r)}function bt(n,i,r){var u=r===undefined?n:n.slice(0,li(n,"name",r));return u.forEach(function(n){n["function"]&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var r=n["function"]||n.fn;n.enabled&&st(r)&&(i.offsets.popper=t(i.offsets.popper),i.offsets.reference=t(i.offsets.reference),i=r(i,n))}),i}function ai(){if(!this.state.isDestroyed){var n={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};if(n.offsets.reference=yt(this.state,this.popper,this.reference),n.placement=vt(this.options.placement,n.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),n.originalPlacement=n.placement,n.offsets.popper=wt(this.popper,n.offsets.reference,n.placement),n.offsets.popper.position="absolute",n=bt(this.modifiers,n),this.state.isCreated)this.options.onUpdate(n);else{this.state.isCreated=!0;this.options.onCreate(n)}}}function kt(n,t){return n.some(function(n){var i=n.name,r=n.enabled;return r&&i===t})}function dt(n){for(var u=[!1,"ms","Webkit","Moz","O"],f=n.charAt(0).toUpperCase()+n.slice(1),i,r,t=0;th[a]&&(n.offsets.popper[u]+=o[u]+s-h[a]);n.offsets.popper=t(n.offsets.popper);var g=o[u]+o[v]/2-s/2,b=i(n.instance.popper),nt=parseFloat(b["margin"+y],10),tt=parseFloat(b["border"+y+"Width"],10),p=g-n.offsets.popper[u]-nt-tt;return p=Math.max(Math.min(h[v]-s,p),0),n.arrowElement=e,n.offsets.arrow=(c={},f(c,u,Math.round(p)),f(c,d,""),c),n}function ir(n){return n==="end"?"start":n==="start"?"end":n}function ii(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1,t=v.indexOf(n),i=v.slice(t+1).concat(v.slice(0,t));return r?i.reverse():i}function rr(t,i){if(kt(t.instance.modifiers,"inner")||t.flipped&&t.placement===t.originalPlacement)return t;var e=g(t.instance.popper,t.instance.reference,i.padding,i.boundariesElement),r=t.placement.split("-")[0],o=a(r),u=t.placement.split("-")[1]||"",f=[];switch(i.behavior){case y.FLIP:f=[r,o];break;case y.CLOCKWISE:f=ii(r);break;case y.COUNTERCLOCKWISE:f=ii(r,!0);break;default:f=i.behavior}return f.forEach(function(s,h){if(r!==s||f.length===h+1)return t;r=t.placement.split("-")[0];o=a(r);var l=t.offsets.popper,v=t.offsets.reference,c=Math.floor,p=r==="left"&&c(l.right)>c(v.left)||r==="right"&&c(l.left)c(v.top)||r==="bottom"&&c(l.top)c(e.right),k=c(l.top)c(e.bottom),g=r==="left"&&w||r==="right"&&b||r==="top"&&k||r==="bottom"&&d,y=["top","bottom"].indexOf(r)!==-1,nt=!!i.flipVariations&&(y&&u==="start"&&w||y&&u==="end"&&b||!y&&u==="start"&&k||!y&&u==="end"&&d);(p||g||nt)&&(t.flipped=!0,(p||g)&&(r=f[h+1]),nt&&(u=ir(u)),t.placement=r+(u?"-"+u:""),t.offsets.popper=n({},t.offsets.popper,wt(t.instance.popper,t.offsets.reference,t.placement)),t=bt(t.instance.modifiers,t,"flip"))}),t}function ur(n){var o=n.offsets,u=o.popper,i=o.reference,s=n.placement.split("-")[0],r=Math.floor,f=["top","bottom"].indexOf(s)!==-1,e=f?"right":"bottom",t=f?"left":"top",h=f?"width":"height";return u[e]r(i[e])&&(n.offsets.popper[t]=r(i[e])),n}function fr(n,i,r,u){var h=n.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),e=+h[1],f=h[2],o,c,s;if(!e)return n;if(f.indexOf("%")===0){o=void 0;switch(f){case"%p":o=r;break;case"%":case"%r":default:o=u}return c=t(o),c[i]/100*e}return f==="vh"||f==="vw"?(s=void 0,s=f==="vh"?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0),s/100*e):e}function er(n,t,i,r){var h=[0,0],c=["right","left"].indexOf(r)!==-1,u=n.split(/(\+|\-)/).map(function(n){return n.trim()}),f=u.indexOf(s(u,function(n){return n.search(/,|\s/)!==-1})),o,e;return u[f]&&u[f].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead."),o=/\s*,\s*|\s+/,e=f!==-1?[u.slice(0,f).concat([u[f].split(o)[0]]),[u[f].split(o)[1]].concat(u.slice(f+1))]:[u],e=e.map(function(n,r){var f=(r===1?!c:c)?"height":"width",u=!1;return n.reduce(function(n,t){return n[n.length-1]===""&&["+","-"].indexOf(t)!==-1?(n[n.length-1]=t,u=!0,n):u?(n[n.length-1]+=t,u=!1,n):n.concat(t)},[]).map(function(n){return fr(n,f,t,i)})}),e.forEach(function(n,t){n.forEach(function(i,r){nt(i)&&(h[t]+=i*(n[r-1]==="-"?-1:1))})}),h}function or(n,t){var f=t.offset,o=n.placement,e=n.offsets,i=e.popper,s=e.reference,u=o.split("-")[0],r=void 0;return r=nt(+f)?[+f,0]:er(f,i,s,u),u==="left"?(i.top+=r[0],i.left-=r[1]):u==="right"?(i.top+=r[0],i.left+=r[1]):u==="top"?(i.left+=r[0],i.top-=r[1]):u==="bottom"&&(i.left+=r[0],i.top+=r[1]),n.popper=i,n}function sr(t,i){var o=i.boundariesElement||r(t.instance.popper),e;t.instance.reference===o&&(o=r(o));e=g(t.instance.popper,t.instance.reference,i.padding,o);i.boundaries=e;var s=i.priority,u=t.offsets.popper,h={primary:function(n){var t=u[n];return u[n]e[n]&&!i.escapeWithReference&&(r=Math.min(u[t],e[n]-(n==="right"?u.width:u.height))),f({},t,r)}};return s.forEach(function(t){var i=["left","top"].indexOf(t)!==-1?"primary":"secondary";u=n({},u,h[i](t))}),t.offsets.popper=u,t}function hr(t){var u=t.placement,l=u.split("-")[0],e=u.split("-")[1];if(e){var o=t.offsets,r=o.reference,s=o.popper,h=["bottom","top"].indexOf(l)!==-1,i=h?"left":"top",c=h?"width":"height",a={start:f({},i,r[i]),end:f({},i,r[i]+r[c]-s[c])};t.offsets.popper=n({},s,a[e])}return t}function cr(n){if(!ti(n.instance.modifiers,"hide","preventOverflow"))return n;var t=n.offsets.reference,i=s(n.instance.modifiers,function(n){return n.name==="preventOverflow"}).boundaries;if(t.bottomi.right||t.top>i.bottom||t.right=0){ft=1;break}et=rt&&window.Promise;ot=et?ri:ui;l=undefined;o=function(){return l===undefined&&(l=navigator.appVersion.indexOf("MSIE 10")!==-1),l};var oi=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},si=function(){function n(n,t){for(var i,r=0;r2&&arguments[2]!==undefined?arguments[2]:{},e;oi(this,t);this.scheduleUpdate=function(){return requestAnimationFrame(u.update)};this.update=ot(this.update.bind(this));this.options=n({},t.Defaults,f);this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]};this.reference=i&&i.jquery?i[0]:i;this.popper=r&&r.jquery?r[0]:r;this.options.modifiers={};Object.keys(n({},t.Defaults.modifiers,f.modifiers)).forEach(function(i){u.options.modifiers[i]=n({},t.Defaults.modifiers[i]||{},f.modifiers?f.modifiers[i]:{})});this.modifiers=Object.keys(this.options.modifiers).map(function(t){return n({name:t},u.options.modifiers[t])}).sort(function(n,t){return n.order-t.order});this.modifiers.forEach(function(n){if(n.enabled&&st(n.onLoad))n.onLoad(u.reference,u.popper,u.options,n,u.state)});this.update();e=this.options.eventsEnabled;e&&this.enableEventListeners();this.state.eventsEnabled=e}return si(t,[{key:"update",value:function(){return ai.call(this)}},{key:"destroy",value:function(){return vi.call(this)}},{key:"enableEventListeners",value:function(){return pi.call(this)}},{key:"disableEventListeners",value:function(){return bi.call(this)}}]),t}();return p.Utils=(typeof window!="undefined"?window:global).PopperUtils,p.placements=it,p.Defaults=vr,p})